package com.zouma;

import com.zouma.pojo.Cntrparty;
import com.zouma.service.CntrpartyService;
import com.zouma.utils.DBEasyhepler;

import java.util.List;

/**
 * @Author: serein
 * @DateTime: 2021/7/6 21:24
 * @Description:
 */
public class ExcelToDbEasy {

    public static void main(String[] args) {
        //得到表格中所有的数据
        List<Cntrparty> listExcel= CntrpartyService.getAllByExcel("d://3.xls");

        DBEasyhepler db=new DBEasyhepler();

        for (Cntrparty Cntrparty : listExcel) {

            int version = Cntrparty.getVersion();
            String sql="insert into CNTRPARTY" +
                    "(cntrpartyType,cntrpartyCode,cntrpartyName,cntrpartyFullName,uniformSocialCreditCode,needCreditFlag,isRelaTrade,cntrparyStatus,version) " +
                    "values(?,?,?,?,?,?,?,?,?)";
            String[] str=new String[]{
                    Cntrparty.getCntrpartyType(),Cntrparty.getCntrpartyCode(),Cntrparty.getCntrpartyName(),
                    Cntrparty.getCntrpartyFullName(),Cntrparty.getUniformSocialCreditCode(), Cntrparty.getNeedCreditFlag(),
                    Cntrparty.getIsRelaTrade(), Cntrparty.getCntrparyStatus(),version+""};
            db.AddU(sql, str);

        }
    }

}
